using System;
using System.Collections.Generic;
using SinBiota.Model.Business.MapServices.Datatypes;
using SinBiota.Model.Entities;

namespace SinBiota.Model.Business.PersistenceServices.Interfaces
{
    public interface IOccurrencePersistenceServices
    {
        Occurrence FindById(int id);
        IList<Occurrence> FindAll();
        void Delete(Occurrence occurrence);
        void DeleteById(int id);
        void SaveOrUpdate(Occurrence occurrence, string username, int occurrenceAuthorId, int municipalityId, int conservationUnitId, int drainageBasinId, int[] ecosystemId, int[] habitatId, int[] microHabitatId, string[] keywordField); 
        
        Project FindProjectById(int id);

        IEnumerable<Occurrence> FindByAmbient(Ambient ambient);
        IEnumerable<Occurrence> FindByAuthorName(string name);
        IEnumerable<Occurrence> FindByKeyword(string keyword);
        IEnumerable<Occurrence> FindByMunicipalityId(int municipalityId);
        IEnumerable<Occurrence> FindByProjectCoordinator(string name);

        IEnumerable<Occurrence> FindByProjectMember(string name);
        IEnumerable<Occurrence> FindByProjectId(int projectId);
        IEnumerable<Occurrence> FindByPublication(string name);
        IEnumerable<Occurrence> FindByTaxonomicGroupId(int taxonomicGroupId);
        IEnumerable<Occurrence> FindByUsername(string username);
        IEnumerable<Occurrence> FindByTaxon(string searchField);

        IEnumerable<LatLongWithId> GetOccurrencesInSquare(double nwLat, double nwLong, double seLat, double seLong);
        IEnumerable<LatLongWithId> GetOccurrencesByTaxon(string taxon);

        IEnumerable<LegacyTaxonomicGroup> FindAllLegacyTaxonomicGroups();

        Specimen FindSpecimenById(int id);

        int NumberOfTaxonomicGroups();

        IEnumerable<OccurrenceAuthor> FindAllOccurrenceAuthors();
        int NumberOfAuthors();
        IDictionary<string, int> OccurrencesByAmbient();
        IDictionary<string , int> OccurrencesByDrainageBasin();
        IDictionary<string, int> OccurrencesByMunicipality();
        IDictionary<string, int> OccurrencesByConservationUnit();
        IDictionary<string, int> OccurrencesByTaxonomicGroup();
        IDictionary<string, int> OccurrencesByMonthYear();

        IDictionary<string, int> SpeciesByConservationUnit();
        IDictionary<string, int> SpeciesByMunicipality();
        IDictionary<string, int> SpeciesByDrainageBasin();
        IDictionary<string, int> SpeciesByAmbient();
        IDictionary<string, int> SpeciesByTaxonomicGroup();

        IDictionary<string, int> SpeciesByMonthYear();
        IDictionary<string, int> Top10Species();

        void IncludeOccurrencesInSpatialDatabase(IEnumerable<Occurrence> occurrences);
        void InitOccurrenceSpatialDatabase();
        void CreateAuthor(OccurrenceAuthor author);

        void DeleteSpecimen(Specimen specimen);
        Taxon FindTaxonById(int taxonId);
        void SaveSpecimen(Specimen specimen);
        IEnumerable<Specimen> FindAllSpecimen();
    }
}